#include<bits/stdc++.h>
using namespace std;
#define int long long
namespace IO
{
	template<typename T>
	void read(T &_x){_x=0;int _f=1;char ch=getchar();while(!isdigit(ch)) _f=(ch=='-'?-1:_f),ch=getchar();while(isdigit(ch)) _x=_x*10+(ch^48),ch=getchar();_x*=_f;}
	template<typename T,typename... Args>
	void read(T &_x,Args&...others){Read(_x);Read(others...);}
	const int BUF=20000000;char buf[BUF],to,stk[32];int plen;
	#define pc(x) buf[plen++]=x
	#define flush(); fwrite(buf,1,plen,stdout),plen=0;
	template<typename T>inline void print(T x){if(!x){pc(48);return;}if(x<0) x=-x,pc('-');for(;x;x/=10) stk[++to]=48+x%10;while(to) pc(stk[to--]);}
}
using namespace IO;
const int N = 1e5+10,M = 1e7+10;
int n,o,tr[M][2],a[N],sum[M],cnt = 1,len,root,x,y,ans;
string s;
inline int insert()
{
	x = root;
	for(int i = 1;i <= len;i++)
	{
		y = s[i]-'0';
		if(!tr[x][y]) tr[x][y] = ++cnt;
		x = tr[x][y]; sum[x]++;
	}
	return x;
}
inline void Get(int x)
{
	while(sum[x] != 1)
	{
		if(!tr[x][0]) tr[x][0] = ++cnt;
		if(!tr[x][1]) tr[x][1] = ++cnt;
		if(sum[tr[x][0]] < sum[tr[x][1]]) x = tr[x][0],ans++;
		else x = tr[x][1],ans++;
		sum[x]++;
	}
}
signed main()
{
	freopen("id.in","r",stdin);
	freopen("id.out","w",stdout);
	read(n);
	for(int i = 1;i <= n;i++) cin >> s,len = s.size(),s = ' '+s,a[i] = insert();
	for(int i = 1;i <= n;i++) if(sum[a[i]] != 1) Get(a[i]);
	print(ans); flush();
	return 0;
}

